package com.wbao.dianniu.manager;

import java.util.ArrayList;
import java.util.List;


/**
 * 活动报名数修改管理类
 * 
 * @author yejianjun
 *
 */
public class ActivitySignupManager {

	private static ActivitySignupManager instance;
	private List<IActivitySignupListener> mList;
	public interface IActivitySignupListener {
		public void signupCountChanged(int activityId, int counts);
	}
	
	public static ActivitySignupManager getInstance(){
		if(null == instance){
			instance = new ActivitySignupManager();
		}
		return instance;
	}
	
	public ActivitySignupManager() {
		mList = new ArrayList<ActivitySignupManager.IActivitySignupListener>();
	}
	
	public void signupChaned(int activityId, int count){
		for (int i = 0; i < mList.size(); i++) {
			mList.get(i).signupCountChanged(activityId, count);
		}
	}
	
	public void addListener(IActivitySignupListener list){
		if(null == mList){
			mList = new ArrayList<ActivitySignupManager.IActivitySignupListener>();
		}
		mList.add(list);
	}
	
	public void removeListener(IActivitySignupListener list){
		if(null != mList){
			mList.remove(list);
		}
	}
	
}
